﻿
@using S4Store.Models
@model LX.Core.Query.PagedList<S4Store.Domain.ImproveGuide>


@{
    ViewBag.Title = "Query";
    Layout = null;
    S4Store.Domain.Administrator CurrentUser = (S4Store.Domain.Administrator)ViewBag.CurrentUser;

}
<div class="pageContent" ratio="*">
<div class="grid">
		<table class="table" width="1000" layoutH="138" cellpadding="0" cellspacing="0">
		<thead>
			<tr>
                <th width="22"><input type="checkbox" group="ids" class="checkboxCtrl"></th>
                <th width="80">发送时间</th>
                <th width="200">来自</th>
                <th width="80">类型</th>
                <th width="50">经理是否阅读</th>
				<th width="50">总经理是否阅读</th>
				<th width="400">信息摘要</th>
			    <th width="50">状态</th>
			</tr>
		</thead>
		<tbody>
            @foreach (var m in this.Model.Data)
            {
                <tr>
                    <td style=" text-align:center"><input name="ids" value="@m.Id" type="checkbox"></td>
                    <td>@m.ImproveDate.ToString("yyyy-MM-dd")</td>
                    <td>@m.ReferenceDesc</td>
                    <td>@m.GuideType.GetDescription()</td>
                    <td>@(m.IsRead ? Html.Raw("<span style='color:green'>已读</span>") : Html.Raw("<span style='color:red'>未读</span>"))</td>
				    <td>@(m.IsManagerRead ? Html.Raw("<span style='color:green'>已读</span>") : Html.Raw("<span style='color:red'>未读</span>"))</td>
				    <td>

                    @if (CurrentUser.Position == S4Store.Domain.Position.SystemManager ||
                         CurrentUser.Position == S4Store.Domain.Position.GeneralManager ||
                         CurrentUser.Position == S4Store.Domain.Position.SaleTutors ||
                         CurrentUser.Position == S4Store.Domain.Position.DealerTutors)
                    {
                        <a href="@Url.Action("Edit", new {id = m.Id})" target="dialog"  refreshonclose="true"  title="修改信息" style="color: Blue; text-decoration: underline">
                    
                            @if (m.ImproveContent != null)
                            {
                                if (m.ImproveContent.Length > 100)
                                {
                                    @Html.Raw(m.ImproveContent.Substring(0, 100) + "...")
                                }
                                else
                                {
                                    @Html.Raw(m.ImproveContent)
                                }
                            }
                        
                        </a>
                    }
                    
                    </td>
                    <td>
                        @(m.StatusValue.ToEnum<S4Store.Domain.ImproveGuide.Status>().GetDescription()) 
                        @if (CurrentUser.Position == S4Store.Domain.Position.SystemManager ||
                             CurrentUser.Position == S4Store.Domain.Position.GeneralManager ||
                             CurrentUser.Position == S4Store.Domain.Position.SaleTutors ||
                             CurrentUser.Position == S4Store.Domain.Position.DealerTutors)
                        {
                            if (m.StatusValue.ToEnum<S4Store.Domain.ImproveGuide.Status>() == S4Store.Domain.ImproveGuide.Status.Draft)
                            {
                                <a href="@Url.Action("Send", new {id = m.Id})" target="ajax" backtype="refresh" title="发送" style="color: Blue; text-decoration: underline">发送</a>
                            }
                        }
                    </td>
			    </tr>	
            }					
		</tbody>
	</table>
</div>
</div>
@Html.Partial("Pager", new PagerModel { Page = Model.Page, Total = Model.Total, PageSize = Model.PageSize })	